#include "TimeManagerTest.h"
#include "Time.h"
#include <stdio.h>
#include <stdlib.h>


TimeManagerTest::TimeManagerTest(void)
{
}


TimeManagerTest::~TimeManagerTest(void)
{
}

bool TimeManagerTest::Test()
{
	printf("=================TimeManagerTest=================\n");
	TimeManager::Instance().Init();
	printf("Init tick:%d time:%d %s\n", GetTick(), GetTime(), GetStrTime());
	for ( size_t i = 0; i < 5; i++ )
	{
		uint msec = rand()%2000+1;
		Pause(msec);
		TimeManager::Instance().Update();
		printf("sleep:%d tick:%d time:%d %s\n", msec, GetTick(), GetTime(), GetStrTime());
	}
	uint uTime = GetTime();
	printf("uTime:%d str1:%s\n", uTime, GetStrTime(uTime));
	printf("uTime:%d year:%d mon:%d day:%d hour:%d min:%d sec:%d\n", uTime, GetYear(), GetMon(), GetDay(), GetHour(), GetMin(), GetSec());
	uTime+= 1234567;
	uint uYear = GetYear(uTime);
	uint uMon  = GetMon(uTime);
	uint uDay  = GetDay(uTime);
	uint uHour = GetHour(uTime);
	uint uMin  = GetMin(uTime);
	uint uSec  = GetSec(uTime);
	printf("uTime:%d year:%d mon:%d day:%d hour:%d min:%d sec:%d\n", uTime, uYear, uMon, uDay, uHour, uMin, uSec);
	uTime = TimeChange(uYear,uMon,uDay,uHour,uMin,uSec);
	printf("uTime:%d\n", uTime);
	printf("=================TimeManagerTest=================\n\n");
	return true;
}
